import { getChannelAPI } from "@/apis/article"
import { useEffect, useState } from "react"

function useChannel(){
  // 频道列表
  const [channelList, setChannelList] = useState([])

  // 调用接口
  useEffect(() => {
    async function fetchChannels() {
      const res = await getChannelAPI()
      setChannelList(res.data.channels)
    }
    fetchChannels()
  }, [])

  return {
    channelList
  }
}

export { useChannel }